package net.wds.ssbus.modules.dict.controller;

import java.util.Arrays;
import java.util.Map;


import net.wds.ssbus.common.utils.PageUtils;
import net.wds.ssbus.common.utils.R;
import net.wds.ssbus.modules.dict.entity.TbBaseDictitemEntity;
import net.wds.ssbus.modules.dict.service.TbBaseDictitemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 字典项表
 *
 * @author WDSource
 * @email 
 * @date 2020-10-19 15:29:52
 */
@RestController
@RequestMapping("/sys/tbbasedictitem")
public class TbBaseDictitemController {
    @Autowired
    private TbBaseDictitemService tbBaseDictitemService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("cultural:tbbasedictitem:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tbBaseDictitemService.queryPage(params);
        return R.ok().put("page", page);
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("cultural:tbbasedictitem:info")
    public R info(@PathVariable("id") Integer id){
		TbBaseDictitemEntity tbBaseDictitem = tbBaseDictitemService.getById(id);
        return R.ok().put("tbBaseDictitem", tbBaseDictitem);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("cultural:tbbasedictitem:save")
    public R save(@RequestBody TbBaseDictitemEntity tbBaseDictitem){
		tbBaseDictitemService.saveTb(tbBaseDictitem);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("cultural:tbbasedictitem:update")
    public R update(@RequestBody TbBaseDictitemEntity tbBaseDictitem){
		tbBaseDictitemService.updateById(tbBaseDictitem);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("cultural:tbbasedictitem:delete")
    public R delete(@RequestBody Integer[] ids){
		tbBaseDictitemService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
